/*
Problem: 1155C
Date: 16-01-2024 03:43 AM
*/
#include <iostream>
using namespace std;
int n, m;
long long x0, g;
long long x[300000], p[300000];
long long gcd(long long a, long long b) {
long long r;
do {
r = a % b;
a = b;
b = r;
}while(r != 0);
return a;
}
int main() {
cin >> n >> m >> x0;
for(int i = 1; i < n; i++) {
cin >> x[i];
x[i] -= x0;
if(i == 1) g = x[i];
else g = gcd(g, x[i]);
}
for(int i = 0; i < m; i++) {
cin >> p[i];
}
for(int i = 0; i < m; i++) {
if(g % p[i] == 0) {
cout << "YES" << endl << x0 << " " << (i + 1) << endl;
return 0;
}
}
cout << "NO" << endl;
}
1625C - Road Optimization | 1715D - 2+ doors |
267A - Subtractions | 1582A - Luntik and Concerts |
560A - Currency System in Geraldion | 946A - Partition |
1068B - LCM | 1692E - Binary Deque |
679A - Bear and Prime 100 | 488A - Giga Tower |
14A - Letter | 1150A - Stock Arbitraging |
1552A - Subsequence Permutation | 1131F - Asya And Kittens |
1475F - Unusual Matrix | 133B - Unary |
1547A - Shortest Path with Obstacle | 624A - Save Luke |
1238A - Prime Subtraction | 1107C - Brutality |
1391B - Fix You | 988B - Substrings Sort |
312A - Whose sentence is it | 513A - Game |
1711E - XOR Triangle | 688A - Opponents |
20C - Dijkstra | 1627D - Not Adding |
893B - Beautiful Divisors | 864B - Polycarp and Letters |